using System;
using System.Collections;
using System.IO;
using Server;
using Server.Mobiles; 
using Server.Items;
using Server.Commands; 
using Server.Network;
using Server.Gumps;

namespace Server.Commands 
{
	public class CreateWorld
	{
		public CreateWorld()
		{
		}

		public static void Initialize() 
		{ 
			CommandSystem.Register( "Createworld", AccessLevel.Administrator, new CommandEventHandler( Create_OnCommand ) ); 
		} 

		[Usage( "[createworld" )]
		[Description( "Create world with a menu." )]
		private static void Create_OnCommand( CommandEventArgs e )
		{
			e.Mobile.SendGump( new CreateWorldGump( e ) );
		}
	}
}

namespace Server.Gumps
{

	public class CreateWorldGump : Gump
	{
		private CommandEventArgs m_CommandEventArgs;
		public CreateWorldGump( CommandEventArgs e ) : base( 50,50 )
		{
			m_CommandEventArgs = e;
			Closable = true;
			Dragable = true;

			AddPage(1);

	//fundo cinza
	//x, y, largura, altura, item
			AddBackground( 0, 0, 240, 450, 5054 );
	//----------
			AddLabel( 40, 2, 200, "CREATE WORLD GUMP" );
	//fundo branco
	//x, y, largura, altura, item
			AddImageTiled( 10, 20, 220, 385, 3004 );
	//----------
			AddLabel( 20, 26, 246, "Generate Moongen " );
			AddLabel( 20, 51, 246, "Generate Door" );
			AddLabel( 20, 76, 246, "Decorate World" );
			AddLabel( 20, 101, 200, "Generate Sign" );
			AddLabel( 20, 126, 246, "Generate Teleport" );
			AddLabel( 20, 151, 246, "Generate Gauntlet" );
			AddLabel( 20, 176, 246, "Generate Champions" );
			AddLabel( 20, 201, 200, "Generate Khaldun" );
			AddLabel( 20, 226, 246, "Generate Doom" );
			AddLabel( 20, 251, 200, "Generate StealArties" );
			AddLabel( 20, 276, 200, "Generate SHTel" );
			AddLabel( 20, 301, 200, "Generate SecretLoc" );
			AddLabel( 20, 326, 246, "Decorate Mondain's" );
                        AddLabel( 20, 351, 246, "Decorate Stygian" );
                        AddLabel( 20, 376, 246, "GenPrimevalLichLever" );
	//Options
	//Options
			AddCheck( 180, 23, 210, 211, true, 101 );
			AddCheck( 180, 48, 210, 211, true, 102 );
			AddCheck( 180, 73, 210, 211, true, 103 );
			AddCheck( 180, 98, 210, 211, true, 104 );
			AddCheck( 180, 123, 210, 211, true, 105 );
			AddCheck( 180, 148, 210, 211, true, 106 );
			AddCheck( 180, 173, 210, 211, true, 107 );
			AddCheck( 180, 198, 210, 211, true, 108 );
			AddCheck( 180, 223, 210, 211, true, 109 );
			AddCheck( 180, 248, 210, 211, true, 110 );
			AddCheck( 180, 273, 210, 211, true, 111 );
			AddCheck( 180, 298, 210, 211, true, 112 );
			AddCheck( 180, 323, 210, 211, true, 113 );
                        AddCheck( 180, 348, 210, 211, true, 114 );
                        AddCheck( 180, 373, 210, 211, true, 115 );  
   

	//Ok, Cancel (x, y, ?, ?, ?)
			AddButton( 60, 415, 247, 249, 1, GumpButtonType.Reply, 0 );
			AddButton( 130, 415, 241, 243, 0, GumpButtonType.Reply, 0 );

		}

		public override void OnResponse( NetState state, RelayInfo info ) 
		{ 
			Mobile from = state.Mobile; 

			switch( info.ButtonID ) 
			{ 
				case 0: // Closed or Cancel
				{
					return;
				}

				default: 
				{ 
					// Make sure that the OK, button was pressed
					if( info.ButtonID == 1 )
					{
						// Get the array of switches selected
						ArrayList Selections = new ArrayList( info.Switches );
						string prefix = Server.Commands.CommandSystem.Prefix;

						from.Say( "CREATING WORLD..." );

						// Now use any selected command
						if( Selections.Contains( 101 ) == true )
						{
							from.Say( "Generating Moongates..." );
							CommandSystem.Handle( from, String.Format( "{0}Moongen", prefix ) );
						}

						if( Selections.Contains( 102 ) == true )
						{
							from.Say( "Generating Doors..." );
							CommandSystem.Handle( from, String.Format( "{0}DoorGen", prefix ) );
						}

						if( Selections.Contains( 103 ) == true )
						{
							from.Say( "Decorating World..." );
							CommandSystem.Handle( from, String.Format( "{0}Decorate", prefix ) );
						}

						if( Selections.Contains( 104 ) == true )
						{
							from.Say( "Generating Signs..." );
							CommandSystem.Handle( from, String.Format( "{0}SignGen", prefix ) );
						}

						if( Selections.Contains( 105 ) == true )
						{
							from.Say( "Generating Teleporters..." );
							CommandSystem.Handle( from, String.Format( "{0}TelGen", prefix ) );
						}

						if( Selections.Contains( 106 ) == true )
						{
							from.Say( "Generating Gauntlet Spawners..." );
							CommandSystem.Handle( from, String.Format( "{0}GenGauntlet", prefix ) );
						}

						if( Selections.Contains( 107 ) == true )
						{
							// champions message in champions script
							CommandSystem.Handle( from, String.Format( "{0}GenChampions", prefix ) );
						}

						if( Selections.Contains( 108 ) == true )
						{
							CommandSystem.Handle( from, String.Format( "{0}GenKhaldun", prefix ) );
						}

						if( Selections.Contains( 109 ) == true )
						{
                                                        CommandSystem.Handle( from, String.Format( "{0}GenLeverPuzzle", prefix ) );
							from.Say( "Doom Lamp Puzzle Generated!" ); 
						}

						if( Selections.Contains( 110 ) == true )
						{
							CommandSystem.Handle( from, String.Format( "{0}GenStealArties", prefix ) );
							from.Say( "Stealable Artifacts Generated!" );
						}

						if( Selections.Contains( 111 ) == true )
						{
							CommandSystem.Handle( from, String.Format( "{0}SHTelGen", prefix ) );
						}

						if( Selections.Contains( 112 ) == true )
						{
							CommandSystem.Handle( from, String.Format( "{0}SecretLocGen", prefix ) );
						}

						if( Selections.Contains( 113 ) == true )
						{
							CommandSystem.Handle( from, String.Format( "{0}DecorateML", prefix ) );
						}
                                                 
                                                if( Selections.Contains( 114 ) == true )
						{
							CommandSystem.Handle( from, String.Format( "{0}DecorateSA", prefix ) );
                                                        from.Say( "Stygian Abyss Decorate!" );  
 						}                                                 

                                                if( Selections.Contains( 115 ) == true )
						{
							CommandSystem.Handle( from, String.Format( "{0}GenLichPuzzle", prefix ) );
                                                        from.Say( "Primeval Lich Puzzle Generated!" );  
 						} 
					}

					from.Say( "World generation completed!" );

					break;
				} 
			} 
		}
	}
}